{% extends 'base.html' %}
{% block title %}  - SEARCH {% endblock %}
{% block js %}
<script type="text/javascript" src="/site_media/js/flowplayer-3.0.3.min.js"></script>
<script type="text/javascript" src="/site_media/js/protoculous-1.0.2-packed.js"></script>
<script type="text/javascript">
	flowplayer("player", "/site_media/flowplayer-3.2.2.swf", {
		clip: {
			url: '/{{video.movie}}',
			provider: 'h264streaming',
			autoPlay:false,
			autoBuffering:true
		},
		plugins: {
			h264streaming: {
				url: '/site_media/flowplayer.pseudostreaming-3.2.2.swf'
			},
			controls: {
				playlist: true,
				url: '/site_media/flowplayer.controls-3.2.1.swf',
				play:true,
				stop:true,
				fullscreen:true,
				scrubber: true
			}
		}
	});
</script>
{% endblock %}
{% block content %}

<div id="content" style="position:absolute; top:20px; left:0px; width:610px; background-color: #1A1A1A; layer-background-color: #1A1A1A;">
    <table width="610">
    <tr>
	  <td colspan="2"><p><span style="font-size:14px;color:#CCC">{% if video.title %} {{video.title}} {% else %} Untitled {% endif %}<a href="/user/videos/edit/{{video.id}}/" title="Edit video"><img src="/site_media/img/approve.gif"></a></span></p></td>
	</tr>   
    <tr><td colspan="2">
	<div id="player" style="display:block;width:600px;height:338px;"></div>
	<br/>
    </td></tr>
    <tr><th width="100">
	Description:
    </td><td>
    {{video.text}} <br/> <br/>
    </td></tr>
    </table>
    <table width="610">
    <tr><td>
	{% if perms.users.is_producer or perms.users.is_kth%}
	<script>
		function check_basket(bas_form){
			if (bas_form.basket.value==""){
				alert("Please chose a basket !");
				return false;
			}
			
			new Ajax.Request("/user/basket/add/", {asynchronous:true, parameters:Form.serialize(bas_form)});
			alert("Successful add to your basket!");
			return false;
		}
	</script>
	<form action="" method="post" onsubmit="return check_basket(this);">
		<select name="basket">
			<option value="">-------</option>
{% for ba in bas %}
			<option value="{{ba.id}}">{{ba.name}}</option>
{% endfor %}
		</select>
		<input name="v_id" type="hidden" value="{{video.id}}"/>
		<input type="submit" value="Add to basket"/> <br/>
		<a href="/user/basket/">Manage your baskets</a>
	</form>
	{% endif %}
    </td></tr>
    <tr><td>
    <FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> </FORM>
</td></tr>    
</table>
</div>
{% endblock %}